package com.wwp.tbshop.view.fragment.diyview;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.wwp.tbshop.R;

;


public class MoreItemView extends RelativeLayout {

	private static final int FIRST = 0;
	private static final int MIDDLE = 1;
	private static final int LAST = 2;

	private ImageView iv;
	private TextView tv;
	private RelativeLayout item_background;

	public MoreItemView(Context context) {
		super(context, null);
		// TODO Auto-generated constructor stub
	}

	public MoreItemView(Context context, AttributeSet attrs) {
		super(context, attrs);

		View inflate = View.inflate(context, R.layout.more_item_view, this);

		item_background = (RelativeLayout) findViewById(R.id.set_item);
		tv = (TextView) findViewById(R.id.siv_set_tv);
		iv = (ImageView) findViewById(R.id.siv_set_iv);

		TypedArray ta = context.obtainStyledAttributes(attrs,
				R.styleable.SettingItemView);
		String string = ta.getString(R.styleable.SettingItemView_sivText);
		int bgID = ta.getInt(R.styleable.SettingItemView_sivBackground, MIDDLE);

		tv.setText(string);

		switch (bgID) {

		case FIRST:
			item_background.setBackgroundResource(R.drawable.first_selector);
			break;
		case MIDDLE:
			item_background.setBackgroundResource(R.drawable.second_selector);
			break;
		case LAST:
			item_background.setBackgroundResource(R.drawable.last_selector);
			break;

		default:
			break;
		}

		ta.recycle();
	}



}
